public class E15_StackTest {

	public static void main(String[] args) {
		Stack<Character> stack = new Stack<Character>();
		String str = "+U+n+c---+e+r+t---+a-+i-+n+t+y---+r+u--+l+e+s---";
		char[] data = str.toCharArray();
		for (int i = 0; i < data.length;) {
			switch (data[i++]) {
			case '+':
				System.out.print(" ");
				stack.push(data[i++]);
				break;
			case '-':
				System.out.print(stack.pop());
				break;
			}
			
		}
	}

}
